<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%jzg_back5}}".
 *
 * @property int $id
 * @property int $status
 * @property string $order_num
 * @property string $user_id 订单人创建人Id
 * @property string $token_id 第三方tokenid
 * @property string $sign 加密参数
 * @property string $status_des 订单状态描述
 * @property string $message
 * @property string $vin
 * @property string $assessment_price_b2c
 * @property string $assessment_price_c2b
 * @property string $max_assessment_price_b2c
 * @property string $resp1_data
 * @property string $resp2_data
 * @property int $created_at
 *
 * @property JzgPlace9Order $vin0
 */
class JzgBack5 extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%jzg_back5}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['status', 'order_num', 'user_id', 'token_id', 'sign', 'created_at'], 'required'],
            [['status', 'created_at'], 'integer'],
            [['sign', 'status_des', 'message', 'resp1_data', 'resp2_data'], 'string'],
            [['order_num'], 'string', 'max' => 150],
            [['user_id', 'token_id', 'vin', 'assessment_price_b2c', 'assessment_price_c2b', 'max_assessment_price_b2c'], 'string', 'max' => 20],
            [['vin'], 'exist', 'skipOnError' => true, 'targetClass' => JzgPlace9Order::className(), 'targetAttribute' => ['vin' => 'vin']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'status' => Yii::t('app', 'Status'),
            'order_num' => Yii::t('app', 'Order Num'),
            'user_id' => Yii::t('app', '订单人创建人Id'),
            'token_id' => Yii::t('app', '第三方tokenid'),
            'sign' => Yii::t('app', '加密参数'),
            'status_des' => Yii::t('app', '订单状态描述'),
            'message' => Yii::t('app', 'Message'),
            'vin' => Yii::t('app', 'Vin'),
            'assessment_price_b2c' => Yii::t('app', 'Assessment Price B2c'),
            'assessment_price_c2b' => Yii::t('app', 'Assessment Price C2b'),
            'max_assessment_price_b2c' => Yii::t('app', 'Max Assessment Price B2c'),
            'resp1_data' => Yii::t('app', 'Resp1 Data'),
            'resp2_data' => Yii::t('app', 'Resp2 Data'),
            'created_at' => Yii::t('app', 'Created At'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getVin0()
    {
        return $this->hasOne(JzgPlace9Order::className(), ['vin' => 'vin']);
    }
}
